package com.sttk.secreconeclick.bookkeep.adapter;

import android.graphics.Bitmap;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.Utils;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lzb.basic.ProviderMultiAdapter;
import com.sttk.secreconeclick.bookkeep.R;
import com.sttk.secreconeclick.bookkeep.bean.AccountBookTypeBean;

public class AccountBookTypeAdapter extends ProviderMultiAdapter<AccountBookTypeBean> {

    public AccountBookTypeAdapter() {
        addItemProvider(new CollectProvider());
    }

    private class CollectProvider extends BaseItemProvider<AccountBookTypeBean> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_account_book_type;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, AccountBookTypeBean bean) {
            baseViewHolder.setImageResource(R.id.ivAccountBookTypeItemImg, bean.getImg());
            baseViewHolder.setText(R.id.tvAccountBookTypeItemName, bean.getName());
            if (bean.isSelected()) {
                baseViewHolder.setImageResource(R.id.ivAccountBookTypeItemSel, R.drawable.select);
            } else {
                baseViewHolder.setImageResource(R.id.ivAccountBookTypeItemSel, R.drawable.noselect);
            }
        }
    }
}